<?php
/**
 *  @department : Commercial development.
 *  @description : This file is part of [BWMS].
 *  DZ all rights reserved.
 */
return  [
    //设置excel字段读取的 模板 与 列数 的字段转化

    //导入商品-导入模板-仅客户用-模板与数据库字段对应关系
    'GOODS_IMPORT' => [
        'list_no'        => 0,
        'import_type'    => 1,
        'picture'        => 2,
        'ems_no'         => 3,
        'client_code'    => 4,
        'self_code'      => 5,
        'good_attribute' => 6,
        'goods_type'     => 7,
        'goods_name'     => 8,
        'abbreviation'   => 9,
        'brand_name'     => 10,
        'specification'  => 11,
        'bar_code'       => 12,
        'supplier'       => 13,
        'origin_country' => 14,
        'trade_country'  => 15,
        'currency'       => 16,
        'hs_code'        => 17,
        'sale_unit'      => 18,
        'std_unit'       => 19,
        'unit_sum1'      => 20,
        'sec_unit'       => 21,
        'unit_sum2'      => 22,
        'ncad_code'      => 23,
        'reg_price'      => 24,
        'is_gift'        => 25,
        'net_wt'         => 26,
        'gross_wt'       => 27,
        'size'           => 28,
        'length'         => 29,
        'wide'           => 30,
        'height'         => 31,
        'notes'          => 32,
        'create_time'    => 33,  //注意：时间字段需要进入GoodsLogic/saveGoodsExcel稍作修改，因为该字段需要格式转换
        'user_id'        => 34,
        'pass_time'      => 35,
        'oss_picture'    => 36,
    ],

    //模本必填, 有效性验证规则, 用于支持验证器
    'GOODS_VALIDATE' => [
        'list_no|序号'           => 'require|integer',
        'import_type|导入类型'     => 'require|checkImportType',
        'client_code|客户编号'     => 'require',
        'good_attribute|货品属性'  => 'require|checkGoodAttribute',
        'goods_type|货品类型'      => 'require|checkGoodsType',
        'goods_name|货品名称'      => 'require',
        'abbreviation|货品简称'    => 'require',
        'brand_name|货品品牌'      => 'require',
        'specification|规格型号'   => 'require',
        'bar_code|条形码'         => 'require',
        'supplier|生产厂家/供应商'    => 'require',
        'origin_country|原产国'   => 'require',
        'currency|币制'          => 'require',
        'hs_code|HSCODE'       => 'require',
        'sale_unit|销售计量单位'     => 'require',
        'std_unit|法定第一计量单位'    => 'require',
        'unit_sum1|法定第一计量单位数量' => 'require',
        // 'sec_unit|法定第二计量单位'    => 'require',
        // 'unit_sum2|法定第二计量单位数量' => 'require',
        'ncad_code|行邮税号'   => 'require',
        'reg_price|备案申报单价' => 'require',
        'is_gift|是否赠品'     => 'require|checkIsGift',
        'net_wt|净重'        => 'require',
        'gross_wt|毛重'      => 'require',
    ],

    //商品导出字段
    'GOODS_EXPORT' => [
        'oss_picture as picture',
        'ems_no',
        // 'go.client_code',
        'CASE WHEN go.client_code is NULL THEN "无" ElSE go.client_code END as client_code',
        'self_code',
        // 'good_attribute',
        'CASE good_attribute WHEN 1 THEN "进口" WHEN 2 THEN "出口" WHEN 3 THEN "其他" END as good_attribute',
        // 'goods_type',
        'CASE goods_type WHEN 0 THEN "基本" WHEN 1 THEN "组合" END as goods_type',
        'goods_name',
        'abbreviation',
        'brand_name',
        'specification',
        'bar_code',
        'supplier',
        'origin_country',
        'trade_country',
        'currency',
        'hs_code',
        'sale_unit',
        'std_unit',
        'unit_sum1',
        'sec_unit',
        'unit_sum2',
        'ncad_code',
        'reg_price',
        // 'is_gift',
        'CASE is_gift WHEN 0 THEN "非赠品" WHEN 1 THEN "赠品" END as is_gift',
        'net_wt',
        'gross_wt',
        'size',
        'length',
        'wide',
        'height',
        'notes',
        'CASE go.create_time WHEN 0 THEN "无" WHEN NULL THEN "无" ElSE  FROM_UNIXTIME(go.create_time, "%Y-%m-%d") END as create_time',
        'account',
        'CASE pass_time WHEN 0 THEN "无" WHEN NULL THEN "无" ElSE FROM_UNIXTIME(pass_time, "%Y-%m-%d") END as pass_time',
    ],

    //新增单个商品检验字段
    'ADD_VALIDATE' => [
        'short_name|客户简称'     => 'require',
        'good_attribute|货品属性' => 'require',
        'goods_type|货品类型'     => 'require',
        'abbreviation|货品简称'   => 'require',
        'goods_name|货品名称'     => 'require',
        'brand_name|货品品牌'     => 'require',
        'specification|规格型号'  => 'require',
        'bar_code|条形码'        => 'require',
        'supplier|生产厂家/供应商'   => 'require',
        'net_wt|净重'           => 'require',
        'gross_wt|毛重'         => 'require',
        'origin_country|原产国'  => 'require',
        'currency|币制'         => 'require',
        'hs_code|HSCODE'      => 'require',
        'sale_unit|销售计量单位'    => 'require',
        'std_unit|法定第一计量单位'   => 'require',
        'ncad_code|行邮税号'      => 'require',
        'reg_price|备案申报单价'    => 'require',
    ],

    //移库单导入
    'MOVE_IMPORT' => [
        'no'                  => 0,
        'move_bill_no'        => 1,
        'create_name'         => 2,
        'create_time'         => 3,
        'move_type'           => 4,
        'client_name'         => 5,
        'client_code'         => 6,
        'good_attribute'      => 7,
        'trade_mode'          => 8,
        'reason'              => 9,
        'goods_name'          => 10,
        'self_code'           => 11,
        'bar_code'            => 12,
        'sku'                 => 13,
        'current_location_no' => 14,
        'target_location_no'  => 15,
        'move_num'            => 16,
        'finish_time'         => 17,
        'review_time'         => 18,
    ],

    //移库单导入检验字段
    'MOVE_VALIDATE' => [
        'move_bill_no'        => 'require',
        'move_type'           => 'require|in:0,1',
        'client_name'         => 'require',
        'client_code'         => 'require',
        'good_attribute'      => 'require|in:1,2,3',
        'trade_mode'          => 'require|in:9610,1210,0100,110,0000,0',
        'reason'              => 'require',
        'goods_name'          => 'max:255',
        'self_code'           => 'max:20',
        'bar_code'            => 'require',
        'sku'                 => 'require',
        'current_location_no' => 'require',
        'target_location_no'  => 'require',
        'move_num'            => 'require',
    ],
];
